package com.yh.concert.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
import com.yh.concert.mapper.YhConcertClassifyMapper;
import com.yh.concert.domain.YhConcertClassify;
import com.yh.concert.service.IYhConcertClassifyService;

/**
 * 分类管理Service业务层处理
 *
 * @author yh
 * @date 2025-02-28
 */
@Service
public class YhConcertClassifyServiceImpl extends ServiceImpl<YhConcertClassifyMapper, YhConcertClassify> implements IYhConcertClassifyService {

    @Autowired
    private YhConcertClassifyMapper yhConcertClassifyMapper;

    /**
     * 查询分类管理列表
     *
     * @param yhConcertClassify 分类管理
     * @return 分类管理
     */
    @Override
    public List<YhConcertClassify> selectYhConcertClassifyList(YhConcertClassify yhConcertClassify)
    {
        List<YhConcertClassify> yhConcertClassifyList = yhConcertClassifyMapper.selectList(buildQueryWrapper(yhConcertClassify));
        return yhConcertClassifyList;
    }


    private LambdaQueryWrapper<YhConcertClassify> buildQueryWrapper(YhConcertClassify query) {
        Map<String, Object> params = query.getParams();
        LambdaQueryWrapper<YhConcertClassify> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(query.getClassifyName()), YhConcertClassify::getClassifyName, query.getClassifyName());
        lqw.eq(StringUtils.isNotBlank(query.getIcon()), YhConcertClassify::getIcon, query.getIcon());
        lqw.orderByDesc(YhConcertClassify::getCreateTime);
        return lqw;
    }

}
